package com.chagee.store.operation.server.service.base;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chagee.store.operation.server.entity.StoreDetailDO;
import com.chagee.store.operation.server.event.dao.StoreDetailMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author : hk
 * @Date : 2024/7/4
 */

@Service
public class StoreDetailBaseService extends ServiceImpl<StoreDetailMapper, StoreDetailDO> {


	/**
	 * 批量查询门店详细信息
	 * @param storeIds ids
	 * @return detail
	 */
	public List<StoreDetailDO> queryByStoreIdList(List<Long> storeIds) {
		QueryWrapper<StoreDetailDO> query = Wrappers.query();
		query.in("store_id", storeIds);
		return baseMapper.selectList(query);
	}

	public StoreDetailDO queryDetailByStoreId(Long id) {
		LambdaQueryWrapper<StoreDetailDO> query = new LambdaQueryWrapper();
		query.eq(StoreDetailDO::getStoreId, id);
		query.last("limit 1");
		return baseMapper.selectOne(query);
	}
}
